package com.agenda.concorrencia;

public class Semaforo {

	private int mutex = 1;

	public synchronized void DOWN() {
		while (mutex != 1) {
			try {
				Thread.currentThread().sleep(200);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		mutex = 0;
	}

	public void UP() {
		mutex = 1;
	}
}
